package com.wfm.threadpooltaskschedule;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@Slf4j
public class MyTest {

    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

    public void test(){

    }

    public void shutdown(){
        if(scheduler!=null){
            try{
                scheduler.shutdown();
                for(;;){
                    if(scheduler.getScheduledExecutor().isTerminated()){
                        break;
                    }
                    Thread.sleep(100);
                }
            }catch (Exception e){
                log.error("停止轮询线程服务异常",e);
            }
        }
    }
}
